Ext.define('BM.controller.TokenCheckOuts', {
    extend: 'Ext.app.Controller',
	views:  ['trade.SelectTokenCheckOut','trade.TokenCheckOut','trade.ShortCut'],
    init: function() {
         this.control({
            'selecttokencheckout button[action=save]': {
                click: this.onToCheckOut
            },
            'shortcut button[action=save]': {
                click: this.onShortCut
            },
            'selecttokencheckout>panel>panel>panel>treepanel':{
            	itemdblclick:this.onTreeSelectToken
            }
        });
    },
    onToCheckOut:function(button){
    
     	var win = button.up('window'),
        form   = win.down('form');
        win.close();
        
    	var view = Ext.widget('tokencheckout');
    	view.show();
    },
    onShortCut:function(button){
    
     	var _win = button.up('window');
        var _form  = _win.down('form');
        _win.close();
        
    	var _view = Ext.widget('tokencheckout');
    	_view.show();
    },
    onTreeSelectToken:function(view,record,item,index,e){
    	
    	Ext.alert.Msg("Test",record.get("text"));
    }
});